package com.bocai.eelly.fragments;

import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;

import com.bocai.eelly.R;
import com.bocai.eelly.activitys.FindFactoryActivity;
import com.bocai.eelly.activitys.FindOrderActivity;
import com.bocai.eelly.common.BaseFragment;

import butterknife.Bind;
import butterknife.ButterKnife;

public class OrderFragment extends BaseFragment implements View.OnClickListener{
    @Bind(R.id.ll_find_factory)
    LinearLayout llFindFactory;
    @Bind(R.id.ll_find_order)
    LinearLayout llFindOrder;
    private View view;

    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        view = LayoutInflater.from(getActivity()).inflate(R.layout.fragment_order, null);
        initView();
        initEvent();
        return view;

    }

    private void initEvent() {
        llFindFactory.setOnClickListener(this);
        llFindOrder.setOnClickListener(this);
    }

    private void initView() {
        ButterKnife.bind(this, view);

    }

    @Override
    public void onDestroyView() {
        super.onDestroyView();
        ButterKnife.unbind(this);
    }

    @Override
    public void onClick(View v) {
        switch (v.getId())
        {
            case R.id.ll_find_factory:
                startActivity(new Intent(getActivity(), FindFactoryActivity.class));
                break;
            case R.id.ll_find_order:
                startActivity(new Intent(getActivity(), FindOrderActivity.class));
                break;
        }
    }
}
